# -*- coding: utf-8 -*-
# @Time    : 2022/5/25 10:13
# @Author  : leijiu
# @Email   : 517711635@qq.com
# @File    : goods_brand_add_page.py
# @Software: PyCharm
"""
添加商品品牌页面
"""
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

class GoodsBrandAdd():
    def __init__(self,driver):
        self.driver=driver

    #商品品牌输入框定位器
    ele_brandname_locator = (By.CSS_SELECTOR,"body > div.main-div > form > table > tbody > tr:nth-child(1) > td:nth-child(2) > input[type=text]")
    #确定按钮定位器
    ele_addbrandbtn_locator = (By.CSS_SELECTOR, "body > div.main-div > form > table > tbody > tr:nth-child(7) > td > input:nth-child(2)")
    #回到品牌列表定位器
    ele_back_brand_locator = (By.XPATH,"/html/body/h1/span[1]/a")
    #输入品牌名称
    def brandname(self):
        self.driver.find_element(*self.ele_brandname_locator).send_keys("大将也")
    #点击确定
    def addbrandbtn(self):
        self.driver.find_element(*self.ele_addbrandbtn_locator).click()
    #回到列表页面
    def backbrandlist(self):
        self.driver.find_element(*self.ele_back_brand_locator).click()
    #编辑
    def alterbrand(self):
        self.driver.find_element(*self.ele_brandname_locator).clear()
        self.driver.find_element(*self.ele_brandname_locator).send_keys("有讯通讯")
        self.driver.find_element(*self.ele_addbrandbtn_locator).click()

